<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>轮回之牢: D:/Code/cProgram/CPP/Qt/TeamCurriculumDesign/Multimedia/AudioPlayer.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">轮回之牢<span id="projectnumber">&#160;0.0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_80876d1476b72d92a9650b7ee3516e4c.html">TeamCurriculumDesign</a></li><li class="navelem"><a class="el" href="dir_0c0c7fbdd3f4ee1791049b02e99730ed.html">Multimedia</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">AudioPlayer.h</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">//</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="comment">// Created by lenovo on 2021/9/14.</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="comment">//</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span> </div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="preprocessor">#ifndef TEAMCURRICULUMDESIGN_AUDIOPLAYER_H</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span><span class="preprocessor">#define TEAMCURRICULUMDESIGN_AUDIOPLAYER_H</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#include &lt;QMediaPlayer&gt;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &quot;../Config/Config.h&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="class_audio_player.html">   15</a></span><span class="keyword">class </span><a class="code hl_class" href="class_audio_player.html">AudioPlayer</a> {</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span>    <span class="keyword">static</span> <span class="keyword">const</span> <a class="code hl_class" href="class_audio_player.html">AudioPlayer</a> &amp;<a class="code hl_function" href="class_audio_player.html#ac8f361a85cab9488415d4a4a1071005c">getInstance</a>();</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#ab787422f19de8d7c2921b5c8a4d7b406">playAudio</a>(<span class="keyword">const</span> std::string &amp;<span class="keywordtype">id</span>, BaseStatus status, GameObject objName) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#a65ebed74e7f2e19c2aa4b78df0295a3a">playBackgroundAudio</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#a4b36f8769986e334d83c0fd3ca9eeb25">deleteAudio</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#a303ae6df08146922ef76f9c2cf4e06af">pauseAll</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#ae0f7bf31afe2b7ed38c5cc0ed399693a">continueAll</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span> </div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#a854be71b4810ab7b8776a9adbc5649f1">VolumeRefresh</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span> </div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>    <span class="keywordtype">void</span> createNewPlayerAndPlay(<span class="keyword">const</span> std::string &amp;<span class="keywordtype">id</span>, BaseStatus status, GameObject obj) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>    <a class="code hl_class" href="class_audio_player.html">AudioPlayer</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>    <a class="code hl_class" href="class_audio_player.html">AudioPlayer</a>(<span class="keyword">const</span> <a class="code hl_class" href="class_audio_player.html">AudioPlayer</a> &amp;other);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>    <span class="keyword">mutable</span> <span class="keywordtype">int</span> mobVolume = 30;</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    <span class="keyword">mutable</span> <span class="keywordtype">int</span> playerVolume = 30;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>    <span class="keyword">mutable</span> <span class="keywordtype">int</span> backgroundVolume = 10;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>    <span class="keyword">mutable</span> QMediaPlayer *backgroundPlayer = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    <span class="keyword">mutable</span> QMediaPlaylist *backgroundPlayList = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>    <span class="comment">/*！</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span><span class="comment">     * @brief 角色音效map</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span><span class="comment">     */</span></div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>    <span class="keyword">mutable</span> QMap&lt;std::string, QMap&lt;GameObject, QMap&lt;BaseStatus, QMediaPlayer *&gt;&gt;&gt; audioMap;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>    <span class="keywordtype">int</span> <a class="code hl_function" href="class_audio_player.html#a4093f53525f122c555d5bc9363b6e088">getMobVolume</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span> </div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#ad981a0464422a3b733bc7a825b2734f6">setMobVolume</a>(<span class="keywordtype">int</span> mobVolume) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span> </div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span>    <span class="keywordtype">int</span> <a class="code hl_function" href="class_audio_player.html#aa1127f0256e18fe688e0c66fdd0fa7e1">getPlayerVolume</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span> </div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#aa6c376883a321394c9a3567b591d2a37">setPlayerVolume</a>(<span class="keywordtype">int</span> playerVolume) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span> </div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span>    <span class="keywordtype">int</span> <a class="code hl_function" href="class_audio_player.html#a063d34bad60e44a85d3291e8dbc57165">getBackgroundVolume</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_audio_player.html#a46775dc89f3e380233124e07e8ca441b">setBackgroundVolume</a>(<span class="keywordtype">int</span> backgroundVolume) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span> </div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>};</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span> </div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span><span class="preprocessor">#define audioInstance (AudioPlayer::getInstance())</span></div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span><span class="preprocessor">#endif </span><span class="comment">//TEAMCURRICULUMDESIGN_AUDIOPLAYER_H</span></div>
<div class="ttc" id="aclass_audio_player_html"><div class="ttname"><a href="class_audio_player.html">AudioPlayer</a></div><div class="ttdoc">音频播放器，单例类</div><div class="ttdef"><b>Definition:</b> AudioPlayer.h:15</div></div>
<div class="ttc" id="aclass_audio_player_html_a063d34bad60e44a85d3291e8dbc57165"><div class="ttname"><a href="class_audio_player.html#a063d34bad60e44a85d3291e8dbc57165">AudioPlayer::getBackgroundVolume</a></div><div class="ttdeci">int getBackgroundVolume() const</div><div class="ttdoc">获取bgm音效大小</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:130</div></div>
<div class="ttc" id="aclass_audio_player_html_a303ae6df08146922ef76f9c2cf4e06af"><div class="ttname"><a href="class_audio_player.html#a303ae6df08146922ef76f9c2cf4e06af">AudioPlayer::pauseAll</a></div><div class="ttdeci">void pauseAll() const</div><div class="ttdoc">暂停所有播放器</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:70</div></div>
<div class="ttc" id="aclass_audio_player_html_a4093f53525f122c555d5bc9363b6e088"><div class="ttname"><a href="class_audio_player.html#a4093f53525f122c555d5bc9363b6e088">AudioPlayer::getMobVolume</a></div><div class="ttdeci">int getMobVolume() const</div><div class="ttdoc">获取怪物音效大小</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:112</div></div>
<div class="ttc" id="aclass_audio_player_html_a46775dc89f3e380233124e07e8ca441b"><div class="ttname"><a href="class_audio_player.html#a46775dc89f3e380233124e07e8ca441b">AudioPlayer::setBackgroundVolume</a></div><div class="ttdeci">void setBackgroundVolume(int backgroundVolume) const</div><div class="ttdoc">设置bgm音效大小，自行刷新</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:134</div></div>
<div class="ttc" id="aclass_audio_player_html_a4b36f8769986e334d83c0fd3ca9eeb25"><div class="ttname"><a href="class_audio_player.html#a4b36f8769986e334d83c0fd3ca9eeb25">AudioPlayer::deleteAudio</a></div><div class="ttdeci">void deleteAudio() const</div><div class="ttdoc">删除所有播放器对象，释放资源</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:100</div></div>
<div class="ttc" id="aclass_audio_player_html_a65ebed74e7f2e19c2aa4b78df0295a3a"><div class="ttname"><a href="class_audio_player.html#a65ebed74e7f2e19c2aa4b78df0295a3a">AudioPlayer::playBackgroundAudio</a></div><div class="ttdeci">void playBackgroundAudio() const</div><div class="ttdoc">播放背景音乐</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:56</div></div>
<div class="ttc" id="aclass_audio_player_html_a854be71b4810ab7b8776a9adbc5649f1"><div class="ttname"><a href="class_audio_player.html#a854be71b4810ab7b8776a9adbc5649f1">AudioPlayer::VolumeRefresh</a></div><div class="ttdeci">void VolumeRefresh() const</div><div class="ttdoc">刷新播放器声音大小</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:85</div></div>
<div class="ttc" id="aclass_audio_player_html_aa1127f0256e18fe688e0c66fdd0fa7e1"><div class="ttname"><a href="class_audio_player.html#aa1127f0256e18fe688e0c66fdd0fa7e1">AudioPlayer::getPlayerVolume</a></div><div class="ttdeci">int getPlayerVolume() const</div><div class="ttdoc">获取玩家音效大小</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:121</div></div>
<div class="ttc" id="aclass_audio_player_html_aa6c376883a321394c9a3567b591d2a37"><div class="ttname"><a href="class_audio_player.html#aa6c376883a321394c9a3567b591d2a37">AudioPlayer::setPlayerVolume</a></div><div class="ttdeci">void setPlayerVolume(int playerVolume) const</div><div class="ttdoc">设置玩家音效大小，自行刷新</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:125</div></div>
<div class="ttc" id="aclass_audio_player_html_ab787422f19de8d7c2921b5c8a4d7b406"><div class="ttname"><a href="class_audio_player.html#ab787422f19de8d7c2921b5c8a4d7b406">AudioPlayer::playAudio</a></div><div class="ttdeci">void playAudio(const std::string &amp;id, BaseStatus status, GameObject objName) const</div><div class="ttdoc">播放音频</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:30</div></div>
<div class="ttc" id="aclass_audio_player_html_ac8f361a85cab9488415d4a4a1071005c"><div class="ttname"><a href="class_audio_player.html#ac8f361a85cab9488415d4a4a1071005c">AudioPlayer::getInstance</a></div><div class="ttdeci">static const AudioPlayer &amp; getInstance()</div><div class="ttdoc">获取本类单例</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:11</div></div>
<div class="ttc" id="aclass_audio_player_html_ad981a0464422a3b733bc7a825b2734f6"><div class="ttname"><a href="class_audio_player.html#ad981a0464422a3b733bc7a825b2734f6">AudioPlayer::setMobVolume</a></div><div class="ttdeci">void setMobVolume(int mobVolume) const</div><div class="ttdoc">设置怪物音效大小，自行刷新</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:116</div></div>
<div class="ttc" id="aclass_audio_player_html_ae0f7bf31afe2b7ed38c5cc0ed399693a"><div class="ttname"><a href="class_audio_player.html#ae0f7bf31afe2b7ed38c5cc0ed399693a">AudioPlayer::continueAll</a></div><div class="ttdeci">void continueAll() const</div><div class="ttdoc">继续所有播放器</div><div class="ttdef"><b>Definition:</b> AudioPlayer.cpp:81</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2
</small></address>
</body>
</html>
